<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>订单列表</h2>
	</div>
	<div class="cf">
       <!-- 高级搜索 -->
		<div class="search-form fr cf">
			<div class="sleft">
				<select name="status">
					<option value="">全部</option>
					<option value="1" <if condition="I('get.status') eq 1">selected</if>>待支付</option>
					<option value="2" <if condition="I('get.status') eq 2">selected</if>>待收货</option>
					<option value="3" <if condition="I('get.status') eq 3">selected</if>>已收货</option>
				</select>
			</div>

			<div class="btn-group-click adv-sch-pannel fl">
				<button class="btn" id="search">搜 索</button>
			</div>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
		<tr>
			<th class="">创建时间</th>
			<th class="">结算单号</th>
			<th class="">关联竞价单号</th>
			<th class="">用户名称</th>
			<th class="">销售数量(金额)</th>
			<th class="">退货数量(金额)</th>
			<th class="">结算数量(金额)</th>
			<th class="">状态</th>
			<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
			<?php $user=M('agent')->field('uid,nickname,username,mobile')->where(array('uid'=>$vo['user_id']))->find(); ?>
			<td>{$vo.create_time|time_format='Y-m-d H:i:s'}</td>
			<td>{$vo.order_sn}</td>
			<td>{$vo.bid_sn}</td>
			<td>{$user.nickname}</td>
			<td class="center">{$vo.good_count}({$vo.total_price})</td>
			<td class="center">{$vo.return_count}({$vo.return_price})</td>
			<td class="center"><?php echo ($vo['good_count']-$vo['return_count']).'('.($vo['total_price']-$vo['return_price']).')';?></td>
			<td>
				{$vo.status|getOrderStatus}
			</td>
			<td>
				<if condition="$vo['status'] eq 1">
					<a href="{:U('setOrderStatus',array('id'=>$vo['id'],'status'=>2))}" class="confirm ajax-get">确认付款</a>
				</if>
            </td>
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript">
        //搜索功能
        $("#search").click(function(){
            var url ="{:U('order')}";
            var query  = $('.search-form').find('select').serialize();;
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //导航高亮
        highlight_subnav('{:U("order")}');
	</script>
</block>
